<?php

namespace Album;

use Zend\Form\View\HelperLoader as FormHelperLoader;
use Zend\Mvc\ModuleRouteListener;
use Album\Model\AlbumTable;
use Zend\Mvc\MvcEvent;
class Module {

//    public function onBootstrap(MvcEvent $e) {
//        $e->getApplication()->getServiceManager()->get('translator');
//        $eventManager = $e->getApplication()->getEventManager();
//        $moduleRouteListener = new ModuleRouteListener();
//        $moduleRouteListener->attach($eventManager);
//    }

    public function getAutoloaderConfig() {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getConfig() {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getServiceConfig() {
        return array(
//            'factories' => array(
//                'album-table' =>  function($sm) {
//                    $dbAdapter = $sm->get('db-adapter');
//                    $table = new AlbumTable($dbAdapter);
//                    return $table;
//                },
//            ),

            'factories' => array(
                'Album\Model\AlbumTable' => function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table = new \Album\Model\AlbumTable($dbAdapter);
                    return $table;
                },
            ),
        );
    }

}
